/**
 * 管理用户信息以及角标信息
 * 设备信息由于不会变动直接读取storage相应内容
 */
import Vue from "vue";
import Vuex from "vuex";
import user from "./user";
import cmark from "./cmark";

Vue.use(Vuex);
const getters = {
  phone: state => state.user.phone,
  token: state => state.user.token,
  userKey: state => state.user.userKey,
  headUrl: state => state.user.headUrl,
  loginType: state => state.user.loginType,
  vipState: state => state.user.vipState,
  vipExpireTime: state => state.user.vipExpireTime,
  cmarkList: state => state.cmark.list
};

export default function(options) {
  return new Vuex.Store({
    modules: {
      user,
      cmark
    },
    getters,
    ...options
  });
}
